package com.lightboat.system.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.lightboat.common.annotation.Excel;
import com.lightboat.common.core.domain.BaseEntity;
import com.lightboat.common.core.domain.entity.SysDept;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 客户对象 crm_customer
 *
 * @author lightboat
 * @date 2025-08-14
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(title = "客户Dto")
public class CrmCustomerDto extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 客户ID */
    @SchemaProperty(name = "客户ID")
    @TableId
    private Long customerId;

    /** 客户来源 */
    @SchemaProperty(name = "客户来源")
    @Excel(name = "客户来源")
    private String customerSource;

    /** 客户姓名 */
    @SchemaProperty(name = "客户姓名")
    @Excel(name = "客户姓名")
    private String customerName;

    /** 客户电话 */
    @SchemaProperty(name = "客户电话")
    @Excel(name = "客户电话")
    private String customerPhone;

    /** 联系地址 */
    @SchemaProperty(name = "联系地址")
    @Excel(name = "联系地址")
    private String contactAddress;

    /** 类别 */
    @SchemaProperty(name = "类别")
    @Excel(name = "类别")
    private String category;

    /** 是否添加微信(0 否 1是) */
    @SchemaProperty(name = "是否添加微信(0 否 1是)")
    @Excel(name = "是否添加微信(0 否 1是)")
    private Integer isAddWechat;

    /** 下单时间 */
    @SchemaProperty(name = "下单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = DateDeserializers.DateDeserializer.class)
    @JsonSerialize(using = DateSerializer.class)
    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date orderTime;

    /** 跟进备注 */
    @SchemaProperty(name = "跟进备注1")
    @Excel(name = "跟进备注1")
    @TableField(exist = false)
    private String followRemark1;
    /** 跟进备注 */
    @SchemaProperty(name = "跟进备注2")
    @Excel(name = "跟进备注2")
    @TableField(exist = false)
    private String followRemark2;

    @TableField(exist = false)
    private Salesman salesman;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Salesman {
        @SchemaProperty(name = "业务员ID")
        private Long salesmanId;
        @SchemaProperty(name = "业务员姓名")
        private String salesmanName;
        @SchemaProperty(name = "业务员电话")
        private String salesmanPhone;
        @SchemaProperty(name = "业务员头像")
        private String avatar;

        @SchemaProperty(name = "业务员部门")
        private SysDept dept;
    }
}
